package kr.co.casually.dialog;

import kr.co.casually.ImageLoader;
import kr.co.casually.R;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;

public class AppCloseDialog extends Dialog implements OnClickListener {
	ImageView ivOK;
	ImageView ivCancel;
	Context mContext;
	Activity mActivity;

	public AppCloseDialog(Context context, Activity act) {
		super(context);
		mContext = context;
		mActivity = act;
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.app_close_dialog);
		ivOK = (ImageView) findViewById(R.id.iv_app_close_dialog_ok);
		ivCancel = (ImageView) findViewById(R.id.iv_app_close_dialog_cancel);
		ivOK.setOnClickListener(this);
		ivCancel.setOnClickListener(this);

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.iv_app_close_dialog_ok:
			mActivity.finish();
			ImageLoader imageLoader = new ImageLoader(mActivity);
			imageLoader.clearCache();
			break;

		case R.id.iv_app_close_dialog_cancel:
			dismiss();
			break;

		default:
			break;
		}
	}

}
